<?php
namespace app\car\model;
use think\Model;
use think\Db;

class Comment extends Model
{
    public function commentAdd($data)
    {
        $data['uid'] = 1;
        $res = Db::table("car_comment")->insert($data);
        return $res;
    }
    public function getCommentListByCid($cid)
    {
        if($cid){
            $result = Db::table("car_comment")->where("status=1 and cid={$cid}")->order("id desc")->limit("0,10")->select();
        }else{
            $result = Db::table("car_comment")->where("status=1")->order("id desc")->limit("0,10")->select();
        }
        return $result;
    }
}